package com.ctrip.ec.biz.dao.shipping;
import com.ctrip.ec.dal.DaoBase;
import com.ctrip.ec.biz.entity.shipping.ShippingConfigEntity;
import com.ctrip.ec.dal.DbAccess;
import org.springframework.stereotype.Service;

import java.sql.SQLException;

@Service
public class ShippingConfigDao extends DaoBase<ShippingConfigEntity> {
    public ShippingConfigDao() {
        super(ShippingConfigEntity.class);
    }
    public ShippingConfigDao(DbAccess db) {
        super(ShippingConfigEntity.class,db);
    }

    public ShippingConfigEntity entityByName(String shippingName) throws SQLException {
        String sql = "select * from " + this.getTableName() + " where name = ?";
        ShippingConfigEntity entity = this.db.getScalar(ShippingConfigEntity.class,sql,shippingName);
        return entity;

    }
}
